<template>
  <div>
    <header>
      <nav class="navbar navbar-expand-lg navbar-dark bg-dark">
        <div class="container">
          <router-link class="navbar-brand " to="/">
            Coding
          </router-link>
          <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent"
                  aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>

          <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav mr-auto">
              <li class="nav-item active">
                <router-link class="nav-link" to="/">主页 <span class="sr-only">(current)</span></router-link>
              </li>
              <li class="nav-item active">
                <a v-on:click="blogButtionClick" class="nav-link" href="#">博客</a>
              </li>
              <li class="nav-item active">
                <router-link class="nav-link" to="/list">课程</router-link>
              </li>
              <li class="nav-item active">
                <a class="nav-link" href="#" v-on:click="blogButtionClick">直播</a>
              </li>
              <li class="nav-item active">
                <a class="nav-link" href="#" v-on:click="blogButtionClick">学习区</a>
              </li>
              <li class="nav-item active">
                <a class="nav-link" href="#" v-on:click="blogButtionClick">生活区</a>
              </li>
              <li class="nav-item active">
                <a class="nav-link" href="#" v-on:click="blogButtionClick">甜蜜倾诉</a>
              </li>
              <li class="nav-item dropdown active">
                <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown"
                   aria-haspopup="true" aria-expanded="false">
                  更多
                </a>
                <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                  <a class="dropdown-item" href="#">关于我</a>
                  <a class="dropdown-item" href="#">渠道合作</a>
                  <div class="dropdown-divider"></div>
                  <a class="dropdown-item" href="#">更多信息</a>
                </div>
              </li>
              <!--<li class="nav-item">
                  <a class="nav-link disabled" href="#" tabindex="-1" aria-disabled="true">Disabled</a>
              </li>-->
            </ul>
            <form class="form-inline my-2 my-lg-0 pr-3">
              <input class="form-control mr-sm-2" type="search" placeholder="Search" aria-label="Search">
              <button @click="blogButtionClick" class="btn btn-outline-success my-2 my-sm-0" type="button">搜索</button>
            </form>
            <button @click="openLoginModal()" class="btn btn-outline-light my-2 my-sm-0">登录/注册</button>
          </div>
        </div>
      </nav>
      <Login ref="loginComponent"></Login>
    </header>
  </div>
</template>

<script>

import Login from "@/components/Login";

export default {
  name: "Header",
  components: {Login},
  data: function () {
    return {}
  },
  mounted() {
  },
  created() {
  },
  methods: {
    /**
     * 点击博客按钮
     */
    blogButtionClick() {
      Toast.warning("该功能开发中...")
    },
    /*打开登录注册窗口*/
    openLoginModal() {
      let  _this = this;
      _this.$refs.loginComponent.openLoginModal();
    }
  }
}
</script>

<style scoped>

</style>
